package kr.saeildadim.androidexam_saeildamil.chapter12;

import java.util.ArrayList;

import kr.saeildadim.androidexam_saeildamil.R;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.Toast;

public class Ch12_ListOnly extends ListActivity {
	ArrayList<Myview> arList;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		arList= new ArrayList<Myview>();
		
		arList.add(new Myview(R.drawable.ic_launcher, "삼성 노트북", "아"));
		arList.add(new Myview(R.drawable.ic_launcher, "LG 세탁기","기분"));
		arList.add(new Myview(R.drawable.ic_launcher, "대우 마티즈","좋다 딱딱"));
	
		MyListAdapter adapter = new MyListAdapter(this, R.layout.ch12_icontext, arList);
		
		setListAdapter(adapter);
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		String str = ""+arList.get(position);
		Toast.makeText(Ch12_ListOnly.this, str, Toast.LENGTH_LONG).show();
		
		
	}
	
	
}
